import pandas as pd

def fun_1():
    data = {
        "calories": [420, 380, 390],
        "duration": [50, 40, 45]
    }
    # 数据载入到 DataFrame 对象
    res = pd.DataFrame(data)
    #返回第一行
    print(res.loc[0])
    # 返回 第二行
    print(res.loc[1])
    print("----------------------")
    print(res.loc[0:1])
    print("----------------------")
    # 指定  索引
    res = pd.DataFrame(data,index=['day1','day2','day3'])
    print(res)
    print("----------------------")
    # 指定索引
    print(res.loc["day2"])

def save_csv():
    nme = ["Google", "Runoob", "Taobao", "Wiki"]
    st = ["www.google.com", "www.runoob.com", "www.taobao.com", "www.wikipedia.org"]
    ag = [90, 40, 80, 98]
    # dict
    dict = {'name':nme,'sites':st,'age':ag}

    res = pd.DataFrame(dict)
    res.to_csv('sites.csv')

def read_csv():
    res = pd.read_csv('sites.csv')

    print(res)

if __name__ == '__main__':
    # fun_1()
    # save_csv()
    read_csv()